<template>
   
    <unit></unit>
</template>



<script lang="ts">
import { defineComponent, ref, computed } from 'vue'
import { useStore } from '@/render/store/index'
import Unit from '../units/unit-template.vue' 

export default defineComponent({
  components: {
    Unit
  },
  setup() {
    let store = useStore()
    let info = ref()
    let editableTabs = computed(() => {
      return store.state.base.tabs
    })

    let isEmpty = computed(() => {
      if (editableTabs.value.length > 0) {
        return false
      } else {
        return true
      }
    })
    let numP = 1;
    let numI = 1;
    let editableTabsValue = computed(() => {
      return store.state.base.activeTabName
    })
    let  textArr = ref([
      {shortTAble:'',
        Symbol:'',Mask:'',bitfieldLimits:''}])
       
    let textArrPI = ref([
      {shortTAble:'',
        Symbol:'',Mask:'',bitfieldLimits:''}])
    const removeTab = (targetName: string) => {
      const deleteTabIndex = editableTabs.value?.findIndex(
        (item) => item.title === targetName
      )
      store.dispatch('base/closePage', deleteTabIndex)
    }
  const AddInterToPhys =()=>{
    textArr.value.push({
      shortTAble:'   ',
        Symbol:'  ',
        Mask:'  ',
        bitfieldLimits:'  '})
    
  }
  const AddPhysToInter =()=>{
    textArrPI.value.push({
      shortTAble:'   ',
        Symbol:'  ',
        Mask:'  ',
        bitfieldLimits:'  '})
    
  }
    return {
      isEmpty,
      editableTabs,
      editableTabsValue,
      textArr,
      textArrPI,
      info,
      removeTab,
      AddInterToPhys,
      AddPhysToInter


    }
  },
  data() {
    return {
      form: {
        name: '',
        region: '',
        date1: '',
        date2: '',
        delivery: false,
        type: [],
        resource: '',
        desc: ''
      },
      
   
    }
  },
  methods: {
    onSubmit() {
      console.log('submit!')
    } 
  },watch:{
			orderData:function(newData,oldData){
				console.log(newData)  //newData就是orderData
				// this.itemArrPI = newData;     
				//	methods的函数在这里调用可以获取到newOrderData的值	      
				 
			}
		}
 
})
</script>



<style scoped lang="less">
@import '../../assets/style/index';
 
.editor {
  height: 100%;
  width: 100%;
  .isEmpty {
    display: none;
  }
  & > :deep(.el-tabs__header) {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    height: @main-row-height;
    border-bottom: @border-style;
    background-color: @main-background-color;
    margin: 0;
    .el-tabs__nav-wrap.is-scrollable {
      padding: 0 30px;
    }
    .el-tabs__nav-wrap {
      .el-tabs__nav-next,
      .el-tabs__nav-prev {
        width: 30px;
        height: @main-row-height;
        line-height: @main-row-height;
        .el-icon {
          box-sizing: content-box;
          margin: 5px;
          padding: 4px;
        }
        .el-icon:hover {
          background-color: #ccc;
        }
      }
      .el-tabs__nav-scroll {
        .el-tabs__nav {
          border-radius: 0;
          border: 0;
          .el-tabs__item {
            height: @main-row-height;
            line-height: @main-row-height;
          }
          .el-tabs__item:hover {
            background-color: #ccc;
          }
          .el-tabs__item.is-active {
            background-color: @content-background-color;
            border-bottom: 3px #409eff solid;
          }
        }
      }
    }
  }
  & > :deep(.el-tabs__content) {
    max-height: calc(~'100% - @{main-row-height}');
    min-height: calc(~'100% - @{main-row-height}');
    overflow-y: auto;
    background-color: @content-background-color;
  }
}
.empty {
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #d3dce6;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
.el-row {
    margin-bottom: 20px;
    &:last-child {
      margin-bottom: 0;
    }
  }
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
</style>
